package com.flexycore.iphone.view;

import com.flexycore.iphone.coregraphics.CGRect;
import com.flexycore.iphone.uikit.UIColor;
import com.flexycore.iphone.uikit.UITextBorderStyle;
import com.flexycore.iphone.uikit.UITextField;
import com.flexycore.iphone.uikit.UIView;

/**
 * 
 * @author matthieu nicolazo
 * 
 * Class extending UIView displaying a TextField to edit new cell text.
 *
 */
public class EditCellTextView extends UIView {
	/**
	 * Field
	 */
	private UITextField textField;
	
	/**
	 * Constructor
	 */
	public EditCellTextView(){
		super();
		initWithFrame(CGRect.CGRectZero());
		setBackgroundColor(UIColor.blackColor());
		
		textField = new UITextField();
		textField.initWithFrame(new CGRect().init(60, 30, 200, 30));
		textField.setBorderStyle(UITextBorderStyle.UITextBorderStyleBezel);
		textField.setBackgroundColor(UIColor.whiteColor());
		textField.setTextColor(UIColor.darkGrayColor());
		textField.setText("*** enter your text ***");
		textField.setClearsOnBeginEditing(true);
		
		addSubview(textField);
	}
	
	/**
	 * 
	 * @return		Text entered by user.
	 */
	public String getText(){
		return textField.text();
	}
	
}
